﻿Public Class m_equipos
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub ImageButton1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click
        If txtequipo.Text = "" Then
            Label1.Visible = True
            Label1ast.Visible = True

        Else
            Label1.Visible = False
            Label1ast.Visible = False
            Try

                Dim lNewVariable As String = "INSERT INTO equipos (descripcion) values('{0}')"
                Dim query As String = String.Format(lNewVariable, txtequipo.Text)

                Dim conn As New Devart.Data.PostgreSql.PgSqlConnection(seguridad.conexion)
                conn.Open()
                Dim ejec As New Devart.Data.PostgreSql.PgSqlCommand(query, conn)
                ejec.ExecuteNonQuery()
                txtequipo.Text = ""
                ASPxGridView1.DataBind()
            Catch ex As Exception

            End Try
        End If

    End Sub

    Protected Sub ImageButton4_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton4.Click
        ASPxGridViewExporter1.WritePdfToResponse()
    End Sub

    Protected Sub ImageButton5_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton5.Click
        ASPxGridViewExporter1.WriteXlsxToResponse()
    End Sub

    Protected Sub ImageButton6_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton6.Click
        Dim sUrl As String = "../Reportes/frmequipo.aspx"
        Dim sScript As String = "<script language =javascript> "
        sScript += "window.open('" & sUrl & "',null,'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=500,height=300,left=100,top=100');"
        sScript += "</script> "
        Response.Write(sScript)
        Dim repot As New rptequipo
        repot.EquiposTableAdapter.Fill(repot.DataSet11.equipos)

    End Sub
End Class